package cn.twh.wall.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cn.twh.wall.service.XmlService;
import io.swagger.annotations.Api;
/**
 * XML格式接入挡板处理Controller
 * @author TWH
 */
@RestController
@Api(tags= {"Xml挡板"})
public class XmlController{
	@Autowired
	private XmlService xmlService;
	
    /**
     * 访问入口
     * @param request 请求报文
     * @param headers http请求头
     * @param api 请求接口
     * @return 响应报文
     */
    @RequestMapping(value = "/XMLInput/{api}",method= {RequestMethod.GET,RequestMethod.POST})
    public String wallEnter(@RequestBody String request,@RequestHeader Map<String,String>headers , @PathVariable String api) {
    	String response = xmlService.dpHandler(request,headers,api);
    	return response;
    }
    /**
     * 文件上传挡板访问访问入口
     * @param headers http请求头
     * @param filename 文件名
     */
    @RequestMapping(value = "/XmlFileupload/{filename}",method= {RequestMethod.POST})
    public void wallFileUpload(@RequestHeader MultiValueMap<String, String>headers , @PathVariable String filename) {
    	xmlService.dpHandler(headers,filename);
    }
}